<template>
  <div class="side-container">
    <div class="title" @click="goPicDetail">
      <span>现场晒图</span>
      <div class="side-box">
        <div class="side-video" v-if="side_video_count">
          <span class="side-count" v-if="side_video_count.side_count">{{ side_video_count.side_count }}晒图&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span>
          <span class="video-count" v-if="side_video_count.video_count">{{ side_video_count.video_count }}视频</span>
        </div>
        <div class="icon"></div>
      </div>
    </div>
    <!-- 有图片时显示的盒子 -->
    <div class="side-pics" v-if="small_img.length > 0" @click="goPicDetail">
      <div class="large-img">
        <img :src="large_img.gif_url" alt="" />
      </div>
      <div class="small-img">
        <div class="img-item" v-for="(pic, index) in small_img" :key="index">
          <img :src="pic.url" alt="" />
        </div>
      </div>
    </div>
    <!-- 没有图片时显示的盒子 -->
    <div class="no-side" @click="$emit('show-share-mask')" v-else>分享并记录下你在现场的美拍~~~</div>
  </div>
</template>

<script>
export default {
  props: {
    id: [Number, String],
    large_img: Object,
    small_img: Array,
    side_video_count: Object
  },
  methods: {
    // 前往图片详情页
    goPicDetail() {
      this.$router.push('/posts/' + this.id)
    }
  }
}
</script>

<style lang="less" scoped>
.side-container {
  margin-bottom: 20px;
  padding: 0 10px 20px;
  background-color: #fff;

  .title,
  .side-box {
    font-size: 18px;
    color: #4a4a4a;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;

    &.title {
      font-weight: 700;
      .side-box {
        .side-video {
          color: #cacaca;
          font-size: 12px;
        }
      }

      .icon {
        height: 14px;
        width: 14px;
        margin-left: 3px;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        background-image: url('@/assets/arrow/L0.png');
      }
    }
  }
  .side-pics {
    display: flex;

    .large-img {
      flex: 3;
      height: 130px;
      padding: 1px;
      img {
        height: 100%;
        width: 100%;
      }
    }
    .small-img {
      flex: 2;
      display: flex;
      flex-wrap: wrap;

      .img-item {
        width: 50%;
        height: 65px;
        padding: 2px;

        img {
          height: 100%;
          width: 100%;
        }
      }
    }
  }
  .no-side {
    color: #aaa;
    font-size: 14px;
    padding: 20px 0;
    font-weight: 600;
  }
}
</style>
